package controllers

import (
	"LogServer/models"
	"encoding/json"
	"github.com/astaxie/beego"
	"github.com/astaxie/beego/logs"
)

type DataTransferController struct {
	beego.Controller
}
// URLMapping ...
//func (c *DataTransferController) URLMapping() {
//	c.Mapping("JsonToData", c.JsonToData)
//}
//func JsonToData(data []byte,object *interface{}) interface{}{
//func JsonToData(data []byte, cl *bsereq,) interface{}{
func JsonToUploadData(data []byte, cl *models.ClassLog) interface{}{
	//switch(type)
	//{
	//	case dog:
	//	JsonTodog()
	//}
	err:=json.Unmarshal(data,&cl)
	if err!=nil{
	logs.Error("json转换出错：",err)
		return &err
	}
	return *cl
}

//func jsonTodog(data []byte, type, cl *bsereq,) interface{}{
//
//err:=json.Unmarshal(data,&cl)
//if err!=nil{
//logs.Error("json转换出错：",err)
//return &err
//}
//return *cl
//}